home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 March
/
EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso
/
earcd
/
ear
/
mui23dev.lha
/
MUI
/
Developer
/
Modula
/
txt
/
MuiClasses.def
next >
Wrap
Text File
|
1994-06-30
|
13KB
|
356 lines
DEFINITION MODULE MuiClasses;
(*************************************************************************
** Structures and Macros for creating MUI custom classes.
**
** converted for M2 by Christian 'Kochtopf' Scholz
**
**************************************************************************
**
** $Id: MuiClasses.def 1.6 1994/06/30 21:03:01 Kochtopf Exp $
**
** $Log: MuiClasses.def $
# Revision 1.6 1994/06/30 21:03:01 Kochtopf
# changed again SHORTINT to SHORTCARD for madAddLeft, etc.
#
# Revision 1.5 1994/06/30 20:56:40 Kochtopf
# Typ bei madAddLeft, etc. von BYTE in SHORTINT geändert, um
# besser damit rechnen zu können.
#
# Revision 1.4 1994/06/27 22:04:58 Kochtopf
# changed name from MUIClasses to MuiClasses
# added definition of mCustomClass
#
# Revision 1.3 1994/06/23 21:36:53 Kochtopf
# upgraded to MUI 2.1
# added mCustumClass-Definition
#
# Revision 1.2 1994/02/19 12:42:19 Kochtopf
# Neue Prozeduren hinzugefuegt, die in mui.h definiert waren.
# Ausserdem etwas die Reihenfolge geaendert, so dass man jetzt alles
# benutzen koennen sollte.
#
# Revision 1.1 1994/02/02 09:37:18 Kochtopf
# Initial revision
#
**
**************************************************************************)
FROM SYSTEM IMPORT ADDRESS, WORD, BYTE, LONGSET;
FROM IntuitionD IMPORT ObjectPtr, WindowPtr, ScreenPtr, DrawInfoPtr, IBox,
IntuiMessagePtr, IClassPtr;
FROM ExecD IMPORT LibraryPtr;
FROM GraphicsD IMPORT TextFontPtr, RastPortPtr;
FROM MuiSupport IMPORT APTR;
(*
** at the beginning some general things used for BOOPSI-Objects
*)
(* get a pointer to our instance data *)
PROCEDURE InstData(cl : IClassPtr; obj : ObjectPtr) : ADDRESS;
(* get the size ... *)
PROCEDURE InstSize(cl : IClassPtr) : CARDINAL;
(*
** now the things concerning MUI's view of the things
**
** GENERAL NOTES:
**
** - Everything described in this defintion file is only valid within
** MUI classes. You may never use any of these things out of
** a class, e.g. in a traditional MUI application.
**
** - Except when otherwise stated, all structures are strictly read only.
*)
(* Pointer-Types *)
TYPE mGlobalInfoPtr = POINTER TO mGlobalInfo;
mMinMaxPtr = POINTER TO mMinMax;
mNotifyDataPtr = POINTER TO mNotifyData;
mAreaDataPtr = POINTER TO mAreaData;
mRenderInfoPtr = POINTER TO mRenderInfo;
mConfigurationPtr = ADDRESS;
WORDPtr = POINTER TO WORD;
(*
** Definitions for madFlags
** (you will get these flags e.g. with a Draw-Method.)
*)
TYPE MADFlags = (drawObject, (* completely redraw yourself *)
drawUpdate, (* only update! *)
p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
p12, p13, p14, p15, p16, p17, p18, p19, p20, p21,
p22, p23, p24, p25, p26, p27, p28, p29, p30, p31
(* rest is private, but must be specified to get a LONGSET *)
);
MADFlagSet = SET OF MADFlags;
(*
** Type definitions of some important Methods
** You will need them in your own classes.
*)
(* Area *)
TYPE mpAskMinMaxPtr = POINTER TO mpAskMinMax;
mpDrawPtr = POINTER TO mpDraw;
mpHandleInputPtr= POINTER TO mpHandleInput;
mpSetUpPtr = POINTER TO mpSetUp;
TYPE mpAskMinMax = RECORD
id : LONGINT;
MinMaxInfo : mMinMaxPtr;
END;
mpDraw = RECORD
id : LONGINT;
flags : MADFlagSet;
END;
mpHandleInput = RECORD
id : LONGINT;
imsg : IntuiMessagePtr;
muikey : LONGINT;
END;
mpSetUp = RECORD
id : LONGINT;
RenderInfo : mRenderInfoPtr;
END;
(* (partial) instance data of notify class *)
TYPE mNotifyData = RECORD
mndGlobalInfo : mGlobalInfoPtr;
mndUserData : LONGINT;
priv0 : LONGINT;
priv1 : LONGINT;
priv2 : LONGINT;
priv3 : LONGINT;
priv4 : LONGINT;
END;
(* mMinMax structure holds information about minimum, maximum
and default dimensions of an object. *)
mMinMax = RECORD
MinWidth : CARDINAL;
MinHeight : CARDINAL;
MaxWidth : CARDINAL;
MaxHeight : CARDINAL;
DefWidth : CARDINAL;
DefHeight : CARDINAL;
END;
CONST mMAXMAX = 10000; (* use this if a dimension is not limited. *)
(* (partial) instance data of area class *)
TYPE mAreaData = RECORD
madRenderInfo : mRenderInfoPtr; (* RenderInfo for this object *)
madBackground : ADDRESS(*mImagePtr*); (* Background Image *)
madFont : TextFontPtr; (* Font *)
madMinMax : mMinMax; (* min/max/default sizes *)
madBox : IBox; (* position and dimension *)
madAddLeft : SHORTCARD; (* frame & innerspacing left offset *)
madAddTop : SHORTCARD; (* frame & innerspacing top offset *)
madSubWidth : SHORTCARD; (* frame & innerspacing add. width *)
madSubHeight : SHORTCARD; (* frame & innerspacing add. height *)
madFlags : MADFlagSet; (* see definitions above *)
(* ... private data follows ... *)
END;
(* Global information about configuration and parent application. *)
TYPE mGlobalInfo = RECORD
mgiConfiguration : mConfigurationPtr;
mgiApplicationObject : ObjectPtr;
(* ... private data follows ... *)
END;
(* MUI's draw pens *)
CONST MPENSHINE =0;
CONST MPENHALFSHINE =1;
CONST MPENBACKGROUND =2;
CONST MPENHALFSHADOW =3;
CONST MPENSHADOW =4;
CONST MPENTEXT =5;
CONST MPENFILL =6;
CONST MPENCOUNT =7;
(* Information on display environment *)
TYPE mRenderInfo = RECORD
mriWindowObject : ObjectPtr; (* valid between MUIMSetup/MUIMCleanup *)
mriScreen : ScreenPtr; (* valid between MUIMSetup/MUIMCleanup *)
mriDrawInfo : DrawInfoPtr; (* valid between MUIMSetup/MUIMCleanup *)
mriPens : WORDPtr; (* valid between MUIMSetup/MUIMCleanup *)
mriWindow : WindowPtr; (* valid between MUIMShow/MUIMHide *)
mriRastPort : RastPortPtr; (* valid between MUIMShow/MUIMHide *)
(* ... private data follows ... *)
END;
(*
** some procedures to get some information about our object
*)
PROCEDURE muiNotifyData(obj : APTR) : mNotifyDataPtr;
PROCEDURE muiAreaData(obj : APTR) : mAreaDataPtr;
PROCEDURE muiGlobalInfo(obj : APTR) : mGlobalInfoPtr;
PROCEDURE muiRenderInfo(obj : APTR) : mRenderInfoPtr;
(*
** some more specialized functions to retain information about special
** object-data like rastport, window, etc.
*)
PROCEDURE OBJ_app(obj : APTR) : ObjectPtr;
PROCEDURE OBJ_win(obj : APTR) : ObjectPtr;
PROCEDURE OBJ_dri(obj : APTR) : DrawInfoPtr;
PROCEDURE OBJ_window(obj : APTR) : WindowPtr;
PROCEDURE OBJ_screen(obj : APTR) : ScreenPtr;
PROCEDURE OBJ_rp(obj : APTR) : RastPortPtr;
PROCEDURE OBJ_left(obj : APTR) : INTEGER;
PROCEDURE OBJ_top(obj : APTR) : INTEGER;
PROCEDURE OBJ_width(obj : APTR) : INTEGER;
PROCEDURE OBJ_height(obj : APTR) : INTEGER;
PROCEDURE OBJ_right(obj : APTR) : INTEGER;
PROCEDURE OBJ_bottom(obj : APTR) : INTEGER;
PROCEDURE OBJ_addleft(obj : APTR) : INTEGER;
PROCEDURE OBJ_addtop(obj : APTR) : INTEGER;
PROCEDURE OBJ_subwidth(obj : APTR) : INTEGER;
PROCEDURE OBJ_subheight(obj : APTR) : INTEGER;
PROCEDURE OBJ_mleft(obj : APTR) : INTEGER;
PROCEDURE OBJ_mtop(obj : APTR) : INTEGER;
PROCEDURE OBJ_mwidth(obj : APTR) : INTEGER;
PROCEDURE OBJ_mheight(obj : APTR) : INTEGER;
PROCEDURE OBJ_mright(obj : APTR) : INTEGER;
PROCEDURE OBJ_mbottom(obj : APTR) : INTEGER;
PROCEDURE OBJ_font(obj : APTR) : TextFontPtr;
PROCEDURE OBJ_flags(obj : APTR) : MADFlagSet;
(* User configurable keyboard events coming with MUIMHandleInput *)
CONST MUIKEYRELEASE = -2; (* not a real key, faked when MUIKEYPRESS is released *)
CONST MUIKEYNONE = -1;
CONST MUIKEYPRESS = 0;
CONST MUIKEYTOGGLE = 1;
CONST MUIKEYUP = 2;
CONST MUIKEYDOWN = 3;
CONST MUIKEYPAGEUP = 4;
CONST MUIKEYPAGEDOWN = 5;
CONST MUIKEYTOP = 6;
CONST MUIKEYBOTTOM = 7;
CONST MUIKEYLEFT = 8;
CONST MUIKEYRIGHT = 9;
CONST MUIKEYWORDLEFT = 10;
CONST MUIKEYWORDRIGHT = 11;
CONST MUIKEYLINESTART = 12;
CONST MUIKEYLINEEND = 13;
CONST MUIKEYGADGETNEXT = 14;
CONST MUIKEYGADGETPREV = 15;
CONST MUIKEYGADGETOFF = 16;
CONST MUIKEYWINDOWCLOSE = 17;
CONST MUIKEYWINDOWNEXT = 18;
CONST MUIKEYWINDOWPREV = 19;
CONST MUIKEYHELP = 20;
CONST MUIKEYCOUNT = 21; (* private *)
(*
** now something about dispatchers.
** if you have written your dispatcher make sure it has the format of
** PROCEDURE Dispatcher(cl : IClassPtr; obj : ADDRESS; msg : ADDRESS) : ADDRESS
** (like DispatcherDef)
** Then call in your main routine the procedure MakeDispatcher like this :
** MakeDispatcher(Dispatcher, MyClass),
** where MyClass is the initialized IClassPtr of your new class.
** This function will then set up your dispatcher with a little stub which
** will restore A4 for your (will mean, your programm will be pure, if you
** do all right)
*)
(* here the definition of a dispatcher! *)
TYPE DispatcherDef = PROCEDURE ( (*class*) IClassPtr,
(*object*) ADDRESS,
(*message*) ADDRESS) : ADDRESS;
(* now the procedure MakeDispatcher : *)
PROCEDURE MakeDispatcher(entry:DispatcherDef; VAR myclass : IClassPtr);
(*
** at last a little procedure to fill in the values in the MinMax-Record.
** You can call it inside an AskMinMax-Method, because it is ever the same...
*)
PROCEDURE FillMinMaxInfo (msg : mpAskMinMaxPtr; MinWidth : CARDINAL;
DefWidth : CARDINAL;
MaxWidth : CARDINAL;
MinHeight : CARDINAL;
DefHeight : CARDINAL;
MaxHeight : CARDINAL);
(*
** 2 useful procedures for testing if some coordinates are inside your object
** (converted from the ones in class3.c. So look there how to use... )
*)
(* this will test if x is between a and b *)
PROCEDURE OBJ_between(a,x,b : INTEGER) : BOOLEAN;
(* this will test, if the position (x, y) is inside the Object obj *)
PROCEDURE OBJ_isInObject(x, y : INTEGER; obj : ObjectPtr) : BOOLEAN;
(* MUI_CustomClass returned by MUI_CreateCustomClass() *)
TYPE
mCustomClass = RECORD
mccUserData : APTR; (* use for whatever you want *)
mcc_UtilityBase : LibraryPtr; (* MUI has opened these libraries *)
mcc_DOSBase : LibraryPtr; (* for you automatically. You can *)
mcc_GfxBase : LibraryPtr; (* use them or decide to open *)
mcc_IntuitionBase : LibraryPtr; (* your libraries yourself. *)
mcc_Super : IClassPtr; (* pointer to super class *)
mcc_Class : IClassPtr; (* pointer to the new class *)
(* ... private data follows ... *)
END;
END MuiClasses.